<?php
/**
 * Created by PhpStorm.
 * User: yangqiong
 * Date: 2017/12/3
 * Time: 14:13
 */
$servername = "192.168.7.162";
$username = "admin";
$password = "hot99123";
$dbname = "mtd_action";

// 创建连接
$conn = new mysqli($servername, $username, $password, $dbname);
$conn->query("set character set 'utf8'");
$conn->query("set names 'utf8'");

// 检测连接
if ($conn->connect_error) {
    die("连接失败: " . $conn->connect_error);
}

$sql = "select * from action_conf";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // 输出每行数据
    while($row = $result->fetch_assoc()) {
        echo "<br> id: ". $row["id"]. " - Name: ". $row["title"]. " " . $row["alert_url"];
    }
} else {
    echo "0 个结果";
}
?>